package cn.middle.remote.message;

import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;

import cn.middle.remote.util.ConversionUtil;

public class HeartbeatPingSignal extends BaseSignal {
	
	
	public static final String PING = "ping";

	public HeartbeatPingSignal(String msgId) {
		super(SignalHelper.PING);
		setId(msgId);
	}

	@Override
	public byte[] toData() {
		ByteArrayOutputStream bos = new ByteArrayOutputStream(); 
		DataOutputStream out = new DataOutputStream(bos);
		try {
			out.write(ConversionUtil.writeStringBytes(PING));
			out.flush();
			return bos.toByteArray();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return new byte[0];
	}

}
